<?php

namespace app\manage\services;

//版本表
use app\common\loader\ModelSystem;
use think\Exception;

class SystemVersionService
{
    /**
     * 分页
     * @throws \think\db\exception\DbException
     */
    public function   versionPage($where , $page , $page_size){
        return ModelSystem::SystemVersion()->versionPage($where , $page , $page_size);
    }

    /**
     * 修改状态
     * @throws \think\db\exception\DbException
     */
    public function   versionEditEffect($where , $is_effect){
        $data =  ModelSystem::SystemVersion()->versionEditEffect($where , $is_effect);
        if (!$data){
            throw  new Exception('修改失败', API_ERROR);
        }
        return $data;
    }

    /**
     * 详情
     * @throws \think\db\exception\DbException
     */
    public function   versionInfo($where){
        $data =  ModelSystem::SystemVersion()->versionInfo($where);
        if (empty($data)){
            throw  new Exception('未找到该版本', API_ERROR);
        }
        return $data;
    }

    /**
     * 添加
     * @throws \think\db\exception\DbException
     */
    public function   versionSave($data){
        return ModelSystem::SystemVersion()->versionSave($data);
    }

}